<?php

namespace App\Kuafu\Banner\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;
use App\Kuafu\Shop\Model\Shop;
use Illuminate\Database\Eloquent\Relations\HasOne;

class BannerCommonShopMappingsModel extends BaseModel
{
    use KfSoftDeletes;
    protected $connection = 'mysql';
    protected $table      = 'banner_shop_mappings';
    protected $primaryKey = 'id';

    protected $hidden = [
        'updatedAt',
        'isDeleted'
    ];

    const TYPE_SYSTEM          = 0;
    const TYPE_POSITION_SORT_1 = 1;
    const TYPE_POSITION_SORT_2 = 2;
    const TYPE_POSITION_SORT_3 = 3;
    const TYPE_POSITION_SORT_4 = 4;
    const TYPE_POSITION_SORT_5 = 5;
    const TYPE_POSITION_SORT_6 = 6;

    const TYPE_TEXT = [
        self::TYPE_SYSTEM          => "后台配置",
        self::TYPE_POSITION_SORT_1 => "商屏 - 1号位",
        self::TYPE_POSITION_SORT_2 => "商屏 - 2号位",
        self::TYPE_POSITION_SORT_3 => "商屏 - 3号位",
        self::TYPE_POSITION_SORT_4 => "商屏 - 4号位",
        self::TYPE_POSITION_SORT_5 => "商屏 - 5号位",
        self::TYPE_POSITION_SORT_6 => "商屏 - 6号位",
    ];

    /**
     * @return HasOne
     */
    public function mappingShopRelate(): HasOne
    {
        return $this->hasOne(Shop::class, 'id', 'shopId');
    }


}
